[RAILS] Why is ssl_requirement clearing the Flash? (Chrome Mac)

Posted by aaronrussell on Stack Overflow See other posts from Stack Overflow or by aaronrussell
Published on 2010-04-14T16:16:07Z Indexed on 2010/04/14 16:53 UTC
Read the original article Hit count: 160

Filed under:
|
|

I am using ssl_requirement and since setting it up, my application's Flash messages are disappearing.

I've modified the plugin slightly as accounts can optionally have a domain mapped to their account. In that case the non-ssl areas of the site should use the mapped domain, whereas the ssl areas should use the subdomain:

def ensure_proper_protocol
  return true if ssl_allowed?
  if ssl_required? && !request.ssl?
    redirect_to "https://#{@account.subdomain}." + APP_CONF[:domain] + request.request_uri
    flash.keep
    return false
  elsif request.ssl? && !ssl_required?
    redirect_to "http://#{@account.sub_or_mapped_domain}" + request.request_uri
    flash.keep
    return false
  end
end

The application is broadly split into a website (front end) and an admin (back end). ALL of the admin area uses SSL so in the AdminController I have overwritten ssl_required? with:

protected
def ssl_required?
  return false if RAILS_ENV == "test" || RAILS_ENV == "development"
  true
end

Interestingly, Flash messages work fine in the development environment, where I am bypassing requiring SSL, but in my production environment where SSL is required, all Flash are gone.

Any ideas?

EDIT

I've done some further testing and can add that this problem is ONLY occurring in Chrome on the Mac. Other Mac browsers and Chrome on windows are displaying the Flash messages as expected.

This may be a bug with Chrome on the Mac then...?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby